package com.psy.counseling.mapper;

import com.psy.counseling.entity.Test;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.psy.counseling.entity.TestQuestion;
import com.psy.counseling.vo.TestVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import com.psy.counseling.entity.Question;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 梁学儒
 * @since 2022-05-31
 */
public interface TestMapper extends BaseMapper<Test> {
    @Select("select * from test_question where test_id = #{testId}")
    List<TestQuestion> getRelBySheetId(Integer testId);

    @Insert("insert into test_question(que_id, test_id) values(#{queId}, #{testId})")
    int insertQue(TestQuestion que);

    @Select("select * from question where id in (select que_id from test_question where test_id = #{t_id}")
    List<Question> selectQue(Integer t_id);

    @Select("select test.* ,type_name from test,type where test.typ_id = type.id")
    List<TestVO> getLists();

/*    @Select("select * from song_sheet_rel where sheet_id = #{sheetId}")
    List<SongSheetRel> getRelBySheetId(Integer sheetId);

    @Insert("insert into song_sheet_rel(song_id, sheet_id) values(#{songId}, #{sheetId})")
    int insertRel(SongSheetRel rel);*/
}
